package farmacia.gui.cadastro;

import java.awt.BorderLayout;
import java.awt.EventQueue;
import java.text.ParseException;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.border.EtchedBorder;
import javax.swing.text.MaskFormatter;
import javax.swing.JLabel;
import javax.swing.JTextField;
import javax.swing.JFormattedTextField;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.border.TitledBorder;
import javax.swing.JTable;
import javax.swing.table.DefaultTableModel;
import java.awt.Color;
import javax.swing.UIManager;

public class JfFornecedor extends JFrame {

	private JPanel contentPane;
	private JTextField textField;
	private JTextField textField_1;
	private JTextField textField_2;
	private JTextField textField_3;
	private JTextField textField_4;
	private JTextField textField_5;
	private JTextField textField_6;
	private JTable table;

	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		try {
			UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
		} catch (Throwable e) {
			e.printStackTrace();
		}
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					JfFornecedor frame = new JfFornecedor();
					frame.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}

	/**
	 * Create the frame.
	 * @throws ParseException 
	 */
	public JfFornecedor() throws ParseException {
		setBackground(new Color(102, 255, 204));
		setTitle("Cadastro de Fornecedor");
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setBounds(100, 100, 790, 500);
		contentPane = new JPanel();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		contentPane.setLayout(new BorderLayout(0, 0));
		setContentPane(contentPane);
		
		JPanel panel = new JPanel();
		contentPane.add(panel, BorderLayout.CENTER);
		panel.setLayout(null);
		
		JPanel panel_2 = new JPanel();
		panel_2.setBorder(new TitledBorder(null, "", TitledBorder.LEADING, TitledBorder.TOP, null, null));
		panel_2.setBounds(12, 0, 748, 221);
		panel.add(panel_2);
		panel_2.setLayout(null);
		
		JPanel panel_1 = new JPanel();
		
		panel_1.setBounds(12, 12, 239, 142);
		panel_2.add(panel_1);
		panel_1.setBorder(new EtchedBorder(EtchedBorder.RAISED, null, null));
		panel_1.setLayout(null);
		
		JLabel lblCod = new JLabel("Cod");
		lblCod.setBounds(12, 12, 70, 14);
		panel_1.add(lblCod);
		
		textField = new JTextField();
		textField.setEditable(false);
		textField.setBounds(12, 27, 63, 18);
		panel_1.add(textField);
		textField.setColumns(10);
		
		JLabel lblNewLabel = new JLabel("CNPJ");
		lblNewLabel.setBounds(87, 12, 70, 14);
		panel_1.add(lblNewLabel);
		
		JFormattedTextField ftCnpj = new JFormattedTextField(new MaskFormatter("##.###.###/####-##"));
		ftCnpj.setBounds(87, 27, 138, 18);
		panel_1.add(ftCnpj);
		
		JLabel lblNome = new JLabel("IE");
		lblNome.setBounds(12, 86, 70, 14);
		panel_1.add(lblNome);
		
		textField_1 = new JTextField();
		textField_1.setBounds(12, 112, 145, 18);
		panel_1.add(textField_1);
		textField_1.setColumns(10);
		
		JLabel lblNome_1 = new JLabel("Nome");
		lblNome_1.setBounds(12, 47, 70, 14);
		panel_1.add(lblNome_1);
		
		textField_4 = new JTextField();
		textField_4.setBounds(12, 67, 213, 18);
		panel_1.add(textField_4);
		textField_4.setColumns(10);
		
		JPanel panel_3 = new JPanel();
		panel_3.setToolTipText("");
		panel_3.setBorder(new EtchedBorder(EtchedBorder.RAISED, null, null));
		panel_3.setBounds(273, 12, 463, 142);
		panel_2.add(panel_3);
		panel_3.setLayout(null);
		
		JLabel lblNewLabel_1 = new JLabel("Endereco");
		lblNewLabel_1.setBounds(10, 12, 70, 14);
		panel_3.add(lblNewLabel_1);
		
		textField_2 = new JTextField();
		textField_2.setBounds(10, 30, 220, 18);
		panel_3.add(textField_2);
		textField_2.setColumns(10);
		
		JLabel lblNewLabel_2 = new JLabel("Complemento");
		lblNewLabel_2.setBounds(242, 12, 107, 14);
		panel_3.add(lblNewLabel_2);
		
		textField_3 = new JTextField();
		textField_3.setBounds(242, 30, 209, 18);
		panel_3.add(textField_3);
		textField_3.setColumns(10);
		
		JLabel lblNewLabel_3 = new JLabel("Cidade");
		lblNewLabel_3.setBounds(297, 49, 70, 14);
		panel_3.add(lblNewLabel_3);
		
		JLabel lblNewLabel_4 = new JLabel("Estado");
		lblNewLabel_4.setBounds(231, 49, 70, 14);
		panel_3.add(lblNewLabel_4);
		
		JComboBox comboBox = new JComboBox();
		comboBox.setBounds(230, 66, 59, 20);
		panel_3.add(comboBox);
		
		JComboBox comboBox_1 = new JComboBox();
		comboBox_1.setBounds(297, 66, 138, 20);
		panel_3.add(comboBox_1);
		
		JLabel lblCep = new JLabel("Cep");
		lblCep.setBounds(137, 49, 70, 14);
		panel_3.add(lblCep);
		
		JFormattedTextField ftCep = new JFormattedTextField(new MaskFormatter("##.###-###"));
		ftCep.setBounds(135, 66, 84, 20);
		panel_3.add(ftCep);
		
		textField_5 = new JTextField();
		textField_5.setBounds(10, 66, 114, 18);
		panel_3.add(textField_5);
		textField_5.setColumns(10);
		
		JLabel lblBairro = new JLabel("Bairro");
		lblBairro.setBounds(10, 49, 70, 14);
		panel_3.add(lblBairro);
		
		textField_6 = new JTextField();
		textField_6.setBounds(97, 193, 419, 18);
		panel_2.add(textField_6);
		textField_6.setColumns(10);
		
		JButton btnNewButton = new JButton("Pesquisar");
		btnNewButton.setBounds(528, 190, 117, 24);
		panel_2.add(btnNewButton);
		
		JButton btnNovo = new JButton("Novo");
		btnNovo.setBounds(12, 426, 117, 24);
		panel.add(btnNovo);
		
		JButton btnAlterar = new JButton("Alterar");
		btnAlterar.setBounds(227, 426, 117, 24);
		panel.add(btnAlterar);
		
		JButton btnSalvar = new JButton("Salvar");
		btnSalvar.setBounds(418, 426, 117, 24);
		panel.add(btnSalvar);
		
		JButton btnExcluir = new JButton("Excluir");
		btnExcluir.setBounds(599, 426, 117, 24);
		panel.add(btnExcluir);
		
		table = new JTable();
		table.setModel(new DefaultTableModel(
			new Object[][] {
				{null, null, null},
				{null, null, null},
				{null, null, null},
				{null, null, null},
				{null, null, null},
			},
			new String[] {
				"Nascimento", "CPF", "Nome"
			}
		) {
			boolean[] columnEditables = new boolean[] {
				false, true, true
			};
			public boolean isCellEditable(int row, int column) {
				return columnEditables[column];
			}
		});
		table.setBounds(12, 241, 748, 173);
		panel.add(table);
	}
}
